1. Field of the Invention
The present invention relates to a semiconductor memory device or a semiconductor device provided with the semiconductor memory device.
2. Description of the Related Art
Almost all architecture of existing CPUs (central processing units) is what is called stored program system. In this stored program system, commands to be processed by the CPU and data required for processing are stored in memory devices. The CPU performs processing by sequentially reading the data from the memory devices.
However, this architecture has a problem of an access speed to the memory device. Since the memory device stores the command to be processed by the CPU and data required for processing, a memory device with high capacitance is required. However, it is difficult to achieve both high capacitance and high-speed processing because a memory device which is capable of high-speed processing is expensive. As an exemplary structure which is capable of high-speed processing even if the memory device has high capacitance, a structure of combination of a memory device with high capacitance and a low processing speed, and a cache memory which is one of memory devices which have low capacitance and are capable of high-speed processing can be given. In that case, the memory device with high capacitance and a low processing speed is a main memory device (also referred to as a main memory) and the memory device which has low capacitance and is capable of high-speed processing is a subordinate memory device.
In operation of the structure of combination of the main memory and the cache memory, part of the data in the main memory is copied into the cache memory and the CPU normally accesses to only the cache memory. Note that to access to the cache memory is called cache access. In an irregular case where required data is not in the cache memory, the CPU recopies the data in the main memory into the cache memory and accesses to the cache memory again. In first cache access, since the data is copied from the main memory, accessing needs some time. On the other hand, in second cache access or later, since the CPU accesses to only the cache memory, processing is performed at higher speed than that in the case of accessing to the main memory. Note that the case where data the CPU requires is in the cache memory is called a cache hit, and the case where the data the CPU requires is not in the cache memory is called a cache miss.
The cache memory which is used in combination with the main memory includes memory lines which are groups of combinations of tag memories and data memories. Each memory line includes a valid bit in the tag memory. The valid bit shows whether data stored in the memory line is valid or invalid. Here, for example, the case where invalid data is stored in the memory line corresponds to a time immediately after power supply is turned on. In this case, invalidation processing is required for the valid bits in all the memory lines. This is because the cache memory generally includes an SRAM (static random access memory) and cannot hold data when power supply is off; therefore, the data stored in the cache memory cannot be identified immediately after the power supply is turned on.
However, the invalidation processing for the valid bit is performed on every single memory line and takes some time. Further, during the invalidation processing, the CPU has to be on standby.
Here, a timing chart showing an example of conventional invalidation processing of a valid bit is shown in FIG. 12.
In FIG. 12, a clock signal is a signal 700, a request signal for invalidation processing is a signal 701, a counter signal which is to be an address in the invalidation processing is a signal 702, and a cache access signal from a CPU is a signal 703. When a pulse of the signal 701 is input at an event timing 704, the signal 702 is sequentially counted up with respect to a clock cycle of the signal 700, and the valid bit is sequentially invalidated in accordance with the signal 702 as the address for accessing the cache memory. At an event timing 705, when a counter value reaches the sum of memory lines (n memory lines) which should be invalidated, invalidation processing is completed. Then, a pulse of the signal 703 is input, whereby a normal cache access is started.
In view of the above-described problem, a cache memory which is aimed at speed-up of processing has been proposed in which a control circuit or a buffer circuit is added to a cache memory so that the CPU does not come in a standby state during invalidation processing for the valid bit, and CPU's accessing to the cache memory is judged as a cache miss, and a CPU accesses the main memory in order to promptly store data required after completion of the invalidation processing, in the cache memory (see Patent Document 1: Japanese Published Patent Application No. 2005-44142).